import java.util.concurrent.*;

public class ExecutorService_test {
    public static void main(String[] args) throws Exception {
        ExecutorService pool = Executors.newFixedThreadPool(10);    //异步执行机制
        pool.execute(new Runnable() {       //该方法没有返回值
            @Override
            public void run() {
                System.out.println("execute执行完毕");
            }
        });
        Future future =  pool.submit(new Runnable() {
            @Override
            public void run() {
                System.out.println("submit的Runnable传参执行完毕");
            }
        });
        System.out.println("future执行结果："+future.get());

        Future future1 = pool.submit(new Callable() {
            @Override
            public Object call() throws Exception {
                return "submit的Callable传参执行完毕";
            }
        });
        System.out.println("future1执行结果"+future1.get());
        pool.shutdown();
    }
}
